// 小易的升级之路(模拟+gcd)
#include <iostream>
using namespace std;

int gcd(int a, int b)
{
    return b == 0 ? a : gcd(b, a % b);
}
int main() 
{
    int n, a;
    while (cin >> n >> a)
    {
        while (n--)
        {
            int b;
            cin >> b;
            if (a >= b) a += b;
            else a += gcd(a, b);
        }
        cout << a << endl;
    }
    return 0;
}

// 礼物的最大价值(动态规划)
class Solution {
public:
    int maxValue(vector<vector<int> >& grid) {
        int m = grid.size(), n = grid[0].size();
        vector<vector<int>> dp(m + 1, vector<int>(n + 1));
        for (int i = 1; i <= m; i++)
            for (int j = 1; j <= n; j++)
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + grid[i - 1][j - 1];
        return dp[m][n];
    }
};
    
// 对称之美(字符串哈希)
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vector<string> vs(n);
        for (int i = 0; i < n; i++) cin >> vs[i];
        int l = 0, r = n - 1;
        for (; l < r; l++, r--)
        {
            int hash[26] = {};
            int flag = 0;
            for (auto ch : vs[l]) hash[ch - 'a']++;
            for (auto ch : vs[r])
            {
                if (hash[ch - 'a'])
                {
                    flag = 1;
                    break;
                }
            }
            if (!flag) 
            {
                cout << "No" << endl;
                break;
            }
        }
        if (l >= r) cout << "Yes" << endl;
    } 
    return 0;
}
